;; The first four lines of this file were added by Dracula.
;; They tell DrScheme that this is a Dracula Modular ACL2 program.
;; Leave these lines unchanged so that DrScheme can properly load this file.
#reader(planet "reader.rkt" ("cce" "dracula.plt") "modular" "lang")
(require "Iformulas.lisp")
(require "Ischedule-criterion.lisp")
(require "Igpa-criterion.lisp")
(require "Igender-criterion.lisp")
(require "Iskill-sets-criterion.lisp")
(require "Itranspose-fast.lisp")

(module Mformulas

  (import Ischedule-criterion)
  (import Igpa-criterion)
  (import Igender-criterion)
  (import Iskill-sets-criterion)
  (import Itranspose-fast)
  
  (defun get-list-of-all-team-member-data-by-criterion
    (team-flatten-avl)
    (if (consp team-flatten-avl)
        (transpose-fast
         (strip-cdrs team-flatten-avl))
        nil))
  
  (defun calculate-team-score
    (team-key 
     team-flatten-avl
     list-of-actual-weights
     considered-skill-sets-specifications)
    (if (and (consp team-flatten-avl)
             (consp list-of-actual-weights)
             (consp considered-skill-sets-specifications))
        (let* ((num-of-members
                (len team-flatten-avl))
               (list-of-all-team-member-data-by-criterion
                (get-list-of-all-team-member-data-by-criterion team-flatten-avl))
               (actual-gpa-weight
                (car list-of-actual-weights))
               (actual-schedule-weight
                (cadr list-of-actual-weights))
               (actual-gender-weight
                (caddr list-of-actual-weights))
               (actual-skill-set-total-weight
                (cadddr list-of-actual-weights))
               (team-gpa-score
                (calculate-team-gpa-score list-of-all-team-member-data-by-criterion
                                          num-of-members
                                          actual-gpa-weight))
               (team-schedule-score
                (calculate-team-schedule-score list-of-all-team-member-data-by-criterion
                                               actual-schedule-weight))
               (team-gender-score
                (calculate-team-gender-score list-of-all-team-member-data-by-criterion
                                             num-of-members
                                             actual-gender-weight))
               (team-skill-sets-score
                (calculate-team-skill-sets-score list-of-all-team-member-data-by-criterion
                                                 num-of-members
                                                 considered-skill-sets-specifications
                                                 actual-skill-set-total-weight)))
          (list team-key
                (+ team-gpa-score
                   team-schedule-score
                   team-gender-score
                   team-skill-sets-score)))
        0))
  
  (export Iformulas)
)